home *** CD-ROM | disk | FTP | other *** search
/ One Click 27 / CD da revista One Click #27 - Photoshop Megapack (2005).iso / Interface / it.dig / scripts / __Packages / mx / utils / CollectionImpl.as < prev    next >
Encoding:
Text File  |  2005-10-28  |  1.3 KB  |  70 lines

  1. class mx.utils.CollectionImpl extends Object
  2. {
  3.    var _items;
  4.    function CollectionImpl()
  5.    {
  6.       super();
  7.       this._items = new Array();
  8.    }
  9.    function addItem(item)
  10.    {
  11.       var _loc2_ = false;
  12.       if(item != null)
  13.       {
  14.          this._items.push(item);
  15.          _loc2_ = true;
  16.       }
  17.       return _loc2_;
  18.    }
  19.    function clear()
  20.    {
  21.       this._items = new Array();
  22.    }
  23.    function contains(item)
  24.    {
  25.       return this.internalGetItem(item) > -1;
  26.    }
  27.    function getItemAt(index)
  28.    {
  29.       return this._items[index];
  30.    }
  31.    function getIterator()
  32.    {
  33.       return new mx.utils.IteratorImpl(this);
  34.    }
  35.    function getLength()
  36.    {
  37.       return this._items.length;
  38.    }
  39.    function isEmpty()
  40.    {
  41.       return this._items.length == 0;
  42.    }
  43.    function removeItem(item)
  44.    {
  45.       var _loc2_ = false;
  46.       var _loc3_ = this.internalGetItem(item);
  47.       if(_loc3_ > -1)
  48.       {
  49.          this._items.splice(_loc3_,1);
  50.          _loc2_ = true;
  51.       }
  52.       return _loc2_;
  53.    }
  54.    function internalGetItem(item)
  55.    {
  56.       var _loc3_ = -1;
  57.       var _loc2_ = 0;
  58.       while(_loc2_ < this._items.length)
  59.       {
  60.          if(this._items[_loc2_] == item)
  61.          {
  62.             _loc3_ = _loc2_;
  63.             break;
  64.          }
  65.          _loc2_ = _loc2_ + 1;
  66.       }
  67.       return _loc3_;
  68.    }
  69. }
  70.